package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.DeptMapper;
import com.itheima.mapper.LogMapper;
import com.itheima.pojo.EmpLog;
import com.itheima.pojo.PageBean;
import com.itheima.service.DeptService;
import com.itheima.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;

    /**
     * 日志分页查询
     * @param page
     * @param pageSize
     * @return
     */
    @Override
    public PageBean log(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        List<EmpLog> logList = logMapper.log();
        Page<EmpLog> p = (Page<EmpLog>) logList;
        return new PageBean(p.getTotal(),p.getResult());
    }
}
